import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  base: "./",
  server: {
    proxy: {
      "/api": {
        target:
          "https://raw.githubusercontent.com/masaikk/masaikk.github.io/master/MGMFF/",
        changeOrigin: true, // 允许跨域
        // ws: true, // 是否启用websockets
        secure: true, // 默认为true，是否需要携带安全证书
        rewrite: (path) => path.replace(/^\/api/, ""), //路径重写，把'/api'替换为''
      },
    },
  },
});
